package com.ygqh.baby.model.ngmm;

import java.math.BigDecimal;

import com.alibaba.fastjson.annotation.JSONField;
import com.ygqh.baby.po.YgOrderDetail;

public class NgmmOrderDetail extends YgOrderDetail {
	
	private Double goodsPrice;
	private Double avgMoney;
	private Double orderAvgMoney;

	@Override
	@JSONField(name = "sku")
	public void setSkuCode(String skuCode) {
		super.setSkuCode(skuCode);
	}

	@Override
	@JSONField(name = "num")
	public void setQuantity(Long quantity) {
		super.setQuantity(quantity);
	}

	public Double getGoosPrice() {
		return goodsPrice;
	}
	
	public void setGoodsPrice(Double goodsPrice) {
		this.goodsPrice = goodsPrice;
	}

	public Double getAvgMoney() {
		return avgMoney;
	}

	@JSONField(name = "avg_money")
	public void setAvgMoney(Double avgMoney) {
		this.avgMoney = avgMoney;
		if (super.getQuantity() > 0) {
			BigDecimal valueOf = BigDecimal.valueOf(avgMoney);
			BigDecimal valueOf2 = BigDecimal.valueOf(super.getQuantity());
			super.setSalePrice(valueOf.divide(valueOf2, 2, BigDecimal.ROUND_HALF_UP));
		}
	}

	public Double getOrderAvgMoney() {
		return orderAvgMoney;
	}

	@JSONField(name = "order_avg_money")
	public void setOrderAvgMoney(Double orderAvgMoney) {
		this.orderAvgMoney = orderAvgMoney;
	}
	
}
